= CURDATE())"; $result = mysql_query($query) or die('COUNT '.mysql_error()); $num_rows = mysql_fetch_row($result); $pages = new Paginator; $pages->items_per_page = 25; $pages->items_total = $num_rows[0]; $pages->mid_range = 5; // Number of pages to display. Must be odd and > 3 $pages->paginate(); if($num_rows[0] == 0){ $limit = ""; $nolist = 1; }else{ $limit = $pages->limit; } $bmquerylist = "SELECT t1.listingID, t1.title, t1.state, t1.city, t1.description, t1.categoryID, t1.parentID, t1.oldID, t1.city_state, t1.type, t1.price, date_format(t1.startdate,'%b %e') as addate, t1.latitude, t1.longitude, t2.photoID, t2.filename, t3.filename as oldfile FROM listings as t1 LEFT JOIN photos as t2 ON t1.parentID=t2.parentID AND t1.listingID=t2.listingID LEFT JOIN photos as t3 ON t1.parentID=t3.parentID AND t1.oldID=t3.listingID WHERE (((t1.latitude BETWEEN ".scrub($latmin,"S")." AND ".scrub($latmax,"S").") AND (t1.longitude BETWEEN ".scrub($longmin,"S")." AND ".scrub($longmax,"S").")) OR t1.zipcode='99999') AND t1.categoryID=".scrub($catID,"S")." AND t1.approved=1 AND t1.suspend=0 AND t1.verified=1 AND (t1.stopdate >= CURDATE()) GROUP BY t1.listingID ORDER BY t1.startdate DESC $limit"; $resultlist=mysql_query($bmquerylist) or die('LIST '.mysql_error()); while($row=mysql_fetch_assoc($resultlist)) { $listingID = $row['listingID']; $title = $row['title']; $lstate = $row['state']; $lcity = $row['city']; $description = $row['description']; $photoID = $row['photoID']; $filename = $row['filename']; $oldfile = $row['oldfile']; $parentID = $row['parentID']; $oldID = $row['oldID']; $adcitystate = $row['city_state']; $type = $row['type']; $price = $row['price']; $addate = $row['addate']; $listlat = $row['latitude']; $listlong = $row['longitude']; $description = stripslashes(scrub($description,'T')); $description = stripslashes(scrub($description,'T')); $description = str_replace('[WEBURL]','',$description); $description = preg_replace('[\[/WEBURL\](.*)\[/LINKTEXT\]]','',$description); $title = stripslashes(scrub($title,'T')); if($oldfile!=''){$filename=$oldfile;} switch ($type) { case 1: $showprice = "$".number_format($price,2); break; case 2: $showprice = "FREEBIE"; $taddon = "FREE! "; break; case 3: $showprice = "Trade/Barter"; break; case 4: $showprice = "WANTED"; $taddon = "WANTED: "; break; case 5: $showprice = "Please Contact"; break; } $cdist = number_format(DistanceCalc($lat,$long,$listlat,$listlong,"M"),2); $linkcity = txt2lnk($lcity); $linkstate = txt2lnk($lstate); $linktitle = ptxt2lnk($title); if($setgrid==1){ if($filename!=''){$fill = "";} else {$fill = "
No
Photo
Available
";} $listings .= "
".$fill."

".$taddon.trunc($title,50)."

".$showprice."

".$adcitystate." - ".$cdist." miles ".$addate."

"; $taddon='';} else { if($filename!=''){$fill = "";} else {$fill = "
No
Photo
";} $listings .= "
".$fill."

".$taddon.trunc($title,50)."

".trunc(stripslashes($description),175)."

".$showprice."

".$adcitystate."
".$cdist." miles ".$addate."

"; $taddon='';} } if($nolist == 1){ $listings = ""; $rurl = "http://api.oodle.com/api/v2/listings?key=CB8B990386B6®ion=usa&location=".$zip."&radius=".$dis."&category=".$oodlecat."&num=15&num_images=1&image_sizes=s&sort=distance&ctime_low=".$backtime."&exclude_sources=everycarlisted-bronze,everycarlisted-gold,everycarlisted-silver&format=php_serial"; $ooresponse = file_get_contents($rurl); $oodata = unserialize($ooresponse); // echo $rurl; // $rssin = simplexml_load_file("http://api.oodle.com/api/v2/listings?key=CB8B990386B6®ion=usa&location=".$zip."&radius=30&category=".$oodlecat."&num=9&num_images=1&image_sizes=s&sort=distance&ctime_low=".$backtime."&php_export"); // echo "http://api.oodle.com/api/v2/listings?key=CB8B990386B6®ion=usa&location=".$zip."&radius=30&category=".$oodlecat."&num=25&num_images=1&image_sizes=s&sort=distance&ctime_low=".$backtime."&format=php_export"; // Here we'll put a loop to include each item's title and description foreach ($oodata['listings'] as $listing) { $linkcity = txt2lnk($listing['location']['name']); $linkstate = txt2lnk($listing['location']['state']); $linktitle = ptxt2lnk($listing['title']); // $linkcity = preg_replace("[\((.*)\)]","",$linkcity); $linkcity = preg_replace("[-\(([A-Za-z0-9-\?=;&_\/]+)\)]","",$linkcity); if($listing['images'][0]['src']!=''){$fill = "";} else {$fill = "
No
Photo
";} $timestamp = $listing['ctime']; $oolistings .= "
".$fill."

".trunc($listing['title'],50)."

".trunc(stripslashes($listing['body']),175)." Found on ".$listing['source']['name']."

".$listing['attributes']['price_display']."

".$listing['location']['name'].",".$listing['location']['state']."
".date('M jS',$timestamp)."

"; } } $descriptadd1 = "Free classified listings featuring ".$titleadd; include('system/getbanners.php'); // Call Banners include('template/header.php'); // Call Header if($specparent != 78){echo"
";include('system/featured.php'); echo"
";} echo $get_num_rows[0]; ?>
HOME > ".$parNAME." > ".$catNAME."  Grid ViewRow View"; echo $listings; echo $oolistings; echo "
".$pages->display_pages()."
"; ?>